import request from '@/utils/request1'

// 查询order列表
export function listOrder(query) {
  return request({
    url: '/system/pos/order/list',
    method: 'get',
    params: query
  })
}

// 查询order详细
export function getOrder(id) {
  return request({
    url: '/system/pos/order/' + id,
    method: 'get'
  })
}

// 新增order
export function addOrder(data) {
  return request({
    url: '/system/pos/order/generate',
    method: 'post',
    data: data
  })
}

export function payOrder(id,data) {
  return request({
    url: '/system/pos/order/addItem/'+id,
    method: 'post',
    data: data
  })
}

// 修改order
export function updateOrder(data) {
  return request({
    url: '/system/pos/order',
    method: 'put',
    data: data
  })
}

// 删除order
export function delOrder(id) {
  return request({
    url: '/system/pos/order/' + id,
    method: 'delete'
  })
}

// 导出order
export function exportOrder(query) {
  return request({
    url: '/system/pos/order/export',
    method: 'get',
    params: query
  })
}

//根据订单条形码查询订单
export function searchOrder(code) {
  return request({
    url: '/system/pos/order/code/'+code,
    method: 'get'
  })
}

//将orderId转成orderCode
export function exchangeOrderId(oid) {
  return request({
    url: '/system/pos/order/id2code/'+oid,
    method: 'get'
  })
}